<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>uni-app 2023 | 学习笔记</title><meta name="author" content="lzoxun"><meta name="copyright" content="lzoxun"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="uni-app基于vue和微信小程序, 一套代码可以发布到ios、Android、h5、以及各种小程序平台  开启uniapp原生开发：早期移动端主要 有 IOS 和 Android 两大平台开发原生APP  优点：原生APP 体验、性能、兼容性都非常好，并可以非常方便使用硬件设备，如摄像头 缺点：两个需要单独开发，消耗时间和成本，上线周期繁琐，适合大公司  跨平台开发  优点：一套代码，多端运">
<meta property="og:type" content="article">
<meta property="og:title" content="uni-app 2023">
<meta property="og:url" content="http://example.com/2023/07/22/web/web-app-uniapp-2023/index.html">
<meta property="og:site_name" content="学习笔记">
<meta property="og:description" content="uni-app基于vue和微信小程序, 一套代码可以发布到ios、Android、h5、以及各种小程序平台  开启uniapp原生开发：早期移动端主要 有 IOS 和 Android 两大平台开发原生APP  优点：原生APP 体验、性能、兼容性都非常好，并可以非常方便使用硬件设备，如摄像头 缺点：两个需要单独开发，消耗时间和成本，上线周期繁琐，适合大公司  跨平台开发  优点：一套代码，多端运">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png">
<meta property="article:published_time" content="2023-07-22T07:14:09.697Z">
<meta property="article:modified_time" content="2023-07-22T07:14:09.697Z">
<meta property="article:author" content="lzoxun">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/2023/07/22/web/web-app-uniapp-2023/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":true,"top_n_per_article":1,"unescape":true,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'uni-app 2023',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-07-22 15:14:09'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
    win.getCSS = (url,id = false) => new Promise((resolve, reject) => {
      const link = document.createElement('link')
      link.rel = 'stylesheet'
      link.href = url
      if (id) link.id = id
      link.onerror = reject
      link.onload = link.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        link.onload = link.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(link)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><script>(()=>{
  const $loadingBox = document.getElementById('loading-box')
  const $body = document.body
  const preloader = {
    endLoading: () => {
      $body.style.overflow = ''
      $loadingBox.classList.add('loaded')
    },
    initLoading: () => {
      $body.style.overflow = 'hidden'
      $loadingBox.classList.remove('loaded')
    }
  }

  preloader.initLoading()
  window.addEventListener('load',() => { preloader.endLoading() })

  if (false) {
    document.addEventListener('pjax:send', () => { preloader.initLoading() })
    document.addEventListener('pjax:complete', () => { preloader.endLoading() })
  }
})()</script><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">108</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header"><nav id="nav"><span id="blog-info"><a href="/" title="学习笔记"><span class="site-name">学习笔记</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">uni-app 2023</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-07-22T07:14:09.697Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-07-22T07:14:09.697Z" title="更新于 2023-07-22 15:14:09">2023-07-22</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="uni-app 2023"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><blockquote>
<p>uni-app基于vue和微信小程序, 一套代码可以发布到ios、Android、h5、以及各种小程序平台</p>
</blockquote>
<h2 id="开启uniapp"><a href="#开启uniapp" class="headerlink" title="开启uniapp"></a>开启uniapp</h2><p>原生开发：早期移动端主要 有 <code>IOS</code> 和 <code>Android</code> 两大平台开发<strong>原生APP</strong></p>
<ul>
<li>优点：原生APP <strong>体验、性能、兼容性</strong>都非常好，并可以非常方便使用硬件设备，如摄像头</li>
<li>缺点：两个需要单独开发，<strong>消耗时间和成本</strong>，上线周期繁琐，适合大公司</li>
</ul>
<p>跨平台开发</p>
<ul>
<li>优点：<strong>一套代码，多端运行</strong>，用js实现一套代码，打包生成到各个平台（IOS、Android、各种小程序、H5应用）<ul>
<li>成本低、周期短</li>
</ul>
</li>
<li>缺点：只适合根系统交互少，页面不太复杂的场景，硬件支持相对不好（不适合做高性能、复制用户体验，定制高的程序）</li>
</ul>
<p>跨平台发展史</p>
<ul>
<li><strong>&lt;2009</strong>：   HTML+CSS+JS实现移动端开发</li>
<li><strong>2009-2014</strong>：<code>PhoneGap、Cordova</code>等框架啊</li>
<li><strong>2015</strong>：<strong>ReactNative</strong></li>
<li><strong>2016</strong>：阿里开源 <strong>Weex</strong></li>
<li><strong>2017</strong>：谷歌公布了 <strong>Flutter</strong> 需要掌握 <strong>Dart</strong>  （移动端和PC端都支持）</li>
<li><strong>2017</strong>：<strong>微信小程序</strong>、<strong>uni-app</strong>（底层利用weex）、<strong>Taro</strong> （底层基于 ReactVative）等一下小程序框架啊</li>
</ul>
<p>uniapp</p>
<ul>
<li>优点：容易开发成本低、基于vue、轻、适合开发app、活跃度高、支持 <code>IOS</code> 和 <code>Android</code> <code>web</code> <code>小程序</code> <code>快应用</code></li>
<li>介绍：uni 统一的意思，使用 <a target="_blank" rel="noopener" href="https://uniapp.dcloud.net.cn/">Hbuilder X</a> 开发</li>
<li>创建：Hbuilder X 中<strong>可视化界面创建</strong>，也能用vue-cli命令行创建</li>
<li>对比小程序：支持跨平台、定制低，兼容稳定稍差</li>
<li>如果开发<strong>微信小程序</strong>，最终会通过微信小程<strong>序专有API</strong>转换生成<strong>wxss</strong>那种代码</li>
</ul>
<p><img src= "" data-lazy-src="/../../static%5Cimg%5C2023-02-26_110241.jpg"></p>
<h3 id="Hbuilder-X"><a href="#Hbuilder-X" class="headerlink" title="Hbuilder X"></a>Hbuilder X</h3><p>配置<a target="_blank" rel="noopener" href="https://www.dcloud.io/hbuilderx.html">下载</a></p>
<ul>
<li>快捷键：工具 &gt; 预设快捷键 选择熟悉的 可以选择vscode</li>
<li>注册一个账号</li>
</ul>
<p>运行</p>
<ul>
<li>浏览器</li>
<li>微信小程序<ul>
<li>第一次需要指定微信开发者工具安装路径</li>
<li>并且在开发者工作的<strong>设置 安全</strong>中开启服务端口，运行时就会自动打开（或手动去unpackage目录下打开）</li>
<li>开发<strong>百度、支付宝</strong>下程序，需要安装对应的开发者工具，配置好安装路径就会自动启动</li>
</ul>
</li>
<li>手机模拟器（需要先安装模拟器）<ul>
<li>安卓使用<code>mumu</code>，ISO使用<code>X Code</code></li>
<li>模拟器（Android还需要配置 adb命令行工具）</li>
<li>选择运行App到手机或模拟器</li>
</ul>
</li>
<li>运行到真机<ul>
<li>找到开发者模式，授权USB连接，adb桥接打开，就能直接从运行到Android App基座运行调试</li>
<li>自动搜索到真机的标准基座</li>
<li>遇到问题: 连接usb不弹出授权弹窗，要去用户目录 找到 .android 下的 adbkey 删除，重启HBuilder X，再插入USB</li>
</ul>
</li>
</ul>
<h2 id="目录结构"><a href="#目录结构" class="headerlink" title="目录结构"></a>目录结构</h2><h3 id="pages-json"><a href="#pages-json" class="headerlink" title="pages.json"></a>pages.json</h3><blockquote>
<p>  页面配置文件，路由、页面标题、窗口信息、页面样式 （微信的 app.json）</p>
</blockquote>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">	<span class="attr">&quot;pages&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span></span><br><span class="line">		<span class="punctuation">&#123;</span></span><br><span class="line">			<span class="attr">&quot;path&quot;</span><span class="punctuation">:</span> <span class="string">&quot;pages/index/index&quot;</span><span class="punctuation">,</span></span><br><span class="line">			<span class="attr">&quot;style&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">				<span class="attr">&quot;navigationBarTitleText&quot;</span><span class="punctuation">:</span> <span class="string">&quot;uni-app&quot;</span></span><br><span class="line">			<span class="punctuation">&#125;</span></span><br><span class="line">		<span class="punctuation">&#125;</span></span><br><span class="line">	<span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;globalStyle&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span>  <span class="comment">// 配置公共窗口信息</span></span><br><span class="line">        <span class="attr">&quot;navigationBarBackgroundColor&quot;</span><span class="punctuation">:</span> <span class="string">&quot;#F8F8F8&quot;</span><span class="punctuation">,</span> <span class="comment">// 窗口背景颜色</span></span><br><span class="line">		<span class="attr">&quot;navigationBarTitleText&quot;</span><span class="punctuation">:</span> <span class="string">&quot;uni-app&quot;</span><span class="punctuation">,</span> <span class="comment">// 窗口标题</span></span><br><span class="line">        <span class="attr">&quot;navigationBarTextStyle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;black&quot;</span><span class="punctuation">,</span> <span class="comment">// 窗口标题颜色</span></span><br><span class="line">		<span class="attr">&quot;backgroundColor&quot;</span><span class="punctuation">:</span> <span class="string">&quot;#F8F8F8&quot;</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">    <span class="attr">&quot;tabBar&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span> <span class="comment">// ===================================配置底部菜单</span></span><br><span class="line">	    <span class="attr">&quot;color&quot;</span><span class="punctuation">:</span> <span class="string">&quot;#7A7E83&quot;</span><span class="punctuation">,</span>  <span class="comment">//颜色</span></span><br><span class="line">	    <span class="attr">&quot;selectedColor&quot;</span><span class="punctuation">:</span> <span class="string">&quot;#3cc51f&quot;</span><span class="punctuation">,</span>  <span class="comment">//选中的颜色</span></span><br><span class="line">	    <span class="attr">&quot;borderStyle&quot;</span><span class="punctuation">:</span> <span class="string">&quot;black&quot;</span><span class="punctuation">,</span></span><br><span class="line">	    <span class="attr">&quot;backgroundColor&quot;</span><span class="punctuation">:</span> <span class="string">&quot;#ffffff&quot;</span><span class="punctuation">,</span></span><br><span class="line">		<span class="attr">&quot;position&quot;</span><span class="punctuation">:</span><span class="string">&quot;top&quot;</span><span class="punctuation">,</span> <span class="comment">//仅微信小程序支持</span></span><br><span class="line">	    <span class="attr">&quot;list&quot;</span><span class="punctuation">:</span> <span class="punctuation">[</span><span class="punctuation">&#123;</span></span><br><span class="line">	        <span class="attr">&quot;pagePath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;pages/index/index&quot;</span><span class="punctuation">,</span></span><br><span class="line">	        <span class="attr">&quot;iconPath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;static/logo.png&quot;</span><span class="punctuation">,</span> <span class="comment">//图标路径</span></span><br><span class="line">	        <span class="attr">&quot;selectedIconPath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;static/logo.png&quot;</span><span class="punctuation">,</span> <span class="comment">//选中的图标路径</span></span><br><span class="line">	        <span class="attr">&quot;text&quot;</span><span class="punctuation">:</span> <span class="string">&quot;首页&quot;</span></span><br><span class="line">	    <span class="punctuation">&#125;</span><span class="punctuation">,</span> <span class="punctuation">&#123;</span></span><br><span class="line">	        <span class="attr">&quot;pagePath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;pages/about/new_file&quot;</span><span class="punctuation">,</span></span><br><span class="line">	        <span class="attr">&quot;iconPath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;static/logo.png&quot;</span><span class="punctuation">,</span></span><br><span class="line">	        <span class="attr">&quot;selectedIconPath&quot;</span><span class="punctuation">:</span> <span class="string">&quot;static/logo.png&quot;</span><span class="punctuation">,</span></span><br><span class="line">	        <span class="attr">&quot;text&quot;</span><span class="punctuation">:</span> <span class="string">&quot;关于&quot;</span></span><br><span class="line">	    <span class="punctuation">&#125;</span><span class="punctuation">]</span></span><br><span class="line">	<span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">	<span class="attr">&quot;uniIdRouter&quot;</span><span class="punctuation">:</span> <span class="punctuation">&#123;</span><span class="punctuation">&#125;</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>
<h3 id="App-vue"><a href="#App-vue" class="headerlink" title="App.vue"></a>App.vue</h3><blockquote>
<p>  入口组件，所有页面都在 App.vue 下切换，本身并不是页面，也没有template元素</p>
</blockquote>
<ul>
<li>应用的什么周期</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 应用的什么周期</span></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">    <span class="attr">onLaunch</span>: <span class="keyword">function</span>(<span class="params"></span>) &#123;</span><br><span class="line">        <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;App Launch&#x27;</span>)</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="attr">onShow</span>: <span class="keyword">function</span>(<span class="params"></span>) &#123;</span><br><span class="line">        <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;App Show&#x27;</span>)</span><br><span class="line">    &#125;,</span><br><span class="line">    <span class="attr">onHide</span>: <span class="keyword">function</span>(<span class="params"></span>) &#123;</span><br><span class="line">        <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;App Hide&#x27;</span>)</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<ul>
<li>全局数据</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">    <span class="attr">globalData</span>:&#123;</span><br><span class="line">        <span class="attr">name</span>:<span class="string">&#x27;lzo&#x27;</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// pages 中获取</span></span><br><span class="line"><span class="title function_">onLoad</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="comment">// 拿到全局 App.vue 的 globalData 中的数据</span></span><br><span class="line">    <span class="keyword">const</span> app = <span class="title function_">getApp</span>();</span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(app.<span class="property">globalData</span>.<span class="property">name</span>)</span><br><span class="line">&#125;,</span><br></pre></td></tr></table></figure>

<ul>
<li>定义全局样式，页面中style定义<strong>局部样式</strong>默认有<strong>scoped作用域</strong>了</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">&lt;style&gt;</span><br><span class="line">	<span class="comment">/*每个页面公共css */</span></span><br><span class="line">	<span class="keyword">@import</span> url(<span class="string">&#x27;./static/css/base.scss&#x27;</span>);</span><br><span class="line"></span><br><span class="line">	<span class="selector-class">.globalTestClass</span> &#123;</span><br><span class="line">		<span class="attribute">background-color</span>: <span class="number">#f00</span> <span class="meta">!important</span>;</span><br><span class="line">	&#125;</span><br><span class="line">	page&#123;</span><br><span class="line">		<span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#f0f</span>;</span><br><span class="line">		<span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">		<span class="attribute">height</span>:<span class="number">100%</span>;</span><br><span class="line">	&#125;</span><br><span class="line">&lt;/style&gt;</span><br></pre></td></tr></table></figure>
<h3 id="pages"><a href="#pages" class="headerlink" title="pages"></a>pages</h3><blockquote>
<p>  页面存放位置</p>
</blockquote>
<h4 id="路由跳转"><a href="#路由跳转" class="headerlink" title="路由跳转"></a>路由跳转</h4><p><a target="_blank" rel="noopener" href="https://uniapp.dcloud.io/api/router?id=navigateto">uni.navigateTo</a></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//tabBar页面，并关闭其他非tabBar页面</span></span><br><span class="line">uni.<span class="title function_">switchTab</span>(&#123; </span><br><span class="line">    <span class="attr">url</span>: <span class="string">&#x27;pages/about/new_file&#x27;</span></span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line">uni.<span class="title function_">navigateTo</span>(&#123;</span><br><span class="line">    <span class="attr">url</span>: <span class="string">&#x27;pages/about/new_file&#x27;</span></span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="comment">//替换到新页面</span></span><br><span class="line">uni.<span class="title function_">redirectTo</span>(&#123;</span><br><span class="line">    <span class="attr">url</span>: <span class="string">&#x27;xxx&#x27;</span></span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="comment">// 返回上两级页面</span></span><br><span class="line">uni.<span class="title function_">navigateBack</span>(&#123;</span><br><span class="line">	<span class="attr">delta</span>: <span class="number">2</span></span><br><span class="line">&#125;);</span><br><span class="line"></span><br><span class="line"><span class="comment">// 1、跳转通过?传的参数，子页面onLoad 通过生命周期onLoad获取参数</span></span><br><span class="line"><span class="title function_">onLoad</span>(<span class="params">option</span>) &#123;</span><br><span class="line">    <span class="comment">//监听页面加载 ，并拿到上级页面传递的参数</span></span><br><span class="line">    <span class="comment">//只会触发一次页面切换时不会触发</span></span><br><span class="line">    <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&quot;页面加载了&quot;</span>+ option)</span><br><span class="line">&#125;,</span><br><span class="line">    </span><br><span class="line"><span class="comment">// 2、事件总线</span></span><br><span class="line"><span class="comment">// 3、全局数据 globalData</span></span><br><span class="line"><span class="comment">// 4、本地数据存储</span></span><br><span class="line"><span class="comment">// 5、pinia 等状态管理库</span></span><br></pre></td></tr></table></figure>


<h3 id="main-js"><a href="#main-js" class="headerlink" title="main.js"></a>main.js</h3><blockquote>
<p>  uni-app 的入口文件，初始化vue 、定义全局组件、定义全局属性、安装插件如pinia等</p>
</blockquote>
<h3 id="manifest-json"><a href="#manifest-json" class="headerlink" title="manifest.json"></a>manifest.json</h3><blockquote>
<p>  清单配置文件</p>
</blockquote>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">&#123;</span></span><br><span class="line">    <span class="attr">&quot;appid&quot;</span> <span class="punctuation">:</span> <span class="string">&quot;__UNI__EDA2F03&quot;</span><span class="punctuation">,</span> <span class="comment">// 为UNI项目生成的唯一ID</span></span><br><span class="line">    <span class="comment">/* 小程序特有相关 */</span></span><br><span class="line">    <span class="attr">&quot;mp-weixin&quot;</span> <span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">        <span class="attr">&quot;appid&quot;</span> <span class="punctuation">:</span> <span class="string">&quot;wx3ffcef9fc255b0bc&quot;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;setting&quot;</span> <span class="punctuation">:</span> <span class="punctuation">&#123;</span></span><br><span class="line">            <span class="attr">&quot;urlCheck&quot;</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">false</span></span></span><br><span class="line">        <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line">        <span class="attr">&quot;usingComponents&quot;</span> <span class="punctuation">:</span> <span class="literal"><span class="keyword">true</span></span></span><br><span class="line">    <span class="punctuation">&#125;</span><span class="punctuation">,</span></span><br><span class="line"><span class="punctuation">&#125;</span></span><br></pre></td></tr></table></figure>




<h3 id="uni-scss"><a href="#uni-scss" class="headerlink" title="uni.scss"></a>uni.scss</h3><blockquote>
<p>  全局变量，内部变量，任意页面随意使用，修改后需要重新编译</p>
</blockquote>
<ol>
<li>可以重新uni-app内置样式变量</li>
<li>定义自定义全局变量，<strong>每个页面都可以使用</strong><ol>
<li><code>支持 @import 导入外部文件</code></li>
</ol>
</li>
<li>重新uni-ui内置变量</li>
</ol>
<h3 id="unpackage"><a href="#unpackage" class="headerlink" title="unpackage"></a>unpackage</h3><blockquote>
<p>  打包文件存放路径</p>
</blockquote>
<h3 id="分包"><a href="#分包" class="headerlink" title="分包"></a>分包</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 1、manifest.js &gt; 源码视图</span></span><br><span class="line"> <span class="string">&quot;mp-weixin&quot;</span> : &#123;</span><br><span class="line">		... </span><br><span class="line">        <span class="string">&quot;requiredPrivateInfos&quot;</span> : [ <span class="string">&quot;getLocation&quot;</span>, <span class="string">&quot;chooseLocation&quot;</span> ],</span><br><span class="line">		<span class="string">&quot;optimization&quot;</span>:&#123;<span class="string">&quot;subPackages&quot;</span>:<span class="literal">true</span>&#125; <span class="comment">// 开启分包</span></span><br><span class="line">    &#125;,</span><br><span class="line"><span class="comment">// 2、新建pagesA 将登录页面从pages移动到pagesA中</span></span><br><span class="line"><span class="comment">// 3、pages.json</span></span><br><span class="line"><span class="string">&quot;subPackages&quot;</span>:[</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="string">&quot;root&quot;</span>:<span class="string">&quot;pagesA&quot;</span>, <span class="comment">//子包根目录</span></span><br><span class="line">        <span class="string">&quot;pages&quot;</span>:[</span><br><span class="line">            &#123;</span><br><span class="line">                <span class="string">&quot;path&quot;</span> : <span class="string">&quot;login/login&quot;</span>,</span><br><span class="line">                <span class="string">&quot;style&quot;</span> :                                                                                   </span><br><span class="line">                &#123;</span><br><span class="line">                    <span class="string">&quot;navigationBarBackgroundColor&quot;</span>: <span class="string">&quot;#fff&quot;</span>,</span><br><span class="line">                    <span class="string">&quot;navigationBarTitleText&quot;</span>: <span class="string">&quot;登录&quot;</span>,</span><br><span class="line">                    <span class="string">&quot;enablePullDownRefresh&quot;</span>: <span class="literal">false</span></span><br><span class="line">                &#125;</span><br><span class="line">        	&#125;</span><br><span class="line">        ]</span><br><span class="line">    &#125;,</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="string">&quot;root&quot;</span>:<span class="string">&quot;pagesB&quot;</span>, <span class="comment">//如果有第二个子包</span></span><br><span class="line">        <span class="string">&quot;pages&quot;</span>:[</span><br><span class="line">            &#123;</span><br><span class="line">                <span class="string">&quot;path&quot;</span> : <span class="string">&quot;login/login&quot;</span>,</span><br><span class="line">                <span class="string">&quot;style&quot;</span> :                                                                                   </span><br><span class="line">                &#123;</span><br><span class="line">                    <span class="string">&quot;navigationBarBackgroundColor&quot;</span>: <span class="string">&quot;#fff&quot;</span>,</span><br><span class="line">                    <span class="string">&quot;navigationBarTitleText&quot;</span>: <span class="string">&quot;登录&quot;</span>,</span><br><span class="line">                    <span class="string">&quot;enablePullDownRefresh&quot;</span>: <span class="literal">false</span></span><br><span class="line">                &#125;</span><br><span class="line">        	&#125;</span><br><span class="line">        ]</span><br><span class="line">    &#125;,</span><br><span class="line">]</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="UNI-push"><a href="#UNI-push" class="headerlink" title="UNI push"></a>UNI push</h2><p>manifest.json&#x2F;APP模块配置 勾选 Push(消息推送)</p>
<p>应用详情，各平台信息添加公共证书 <a target="_blank" rel="noopener" href="https://ask.dcloud.net.cn/article/36522">公共证书</a></p>
<p>去uniPush 管理 <a target="_blank" rel="noopener" href="https://dev.dcloud.net.cn/pages/app/push2/info">添加应用</a></p>
<p>关联服务空间，需要实名认证</p>
<p>开通 uniPush 2.0</p>
<h2 id="UI库"><a href="#UI库" class="headerlink" title="UI库"></a>UI库</h2><h4 id="uni-ui"><a href="#uni-ui" class="headerlink" title="uni-ui"></a><a target="_blank" rel="noopener" href="https://uniapp.dcloud.net.cn/component/uniui/quickstart.html">uni-ui</a></h4><p>1、全局导入</p>
<p>2、按需导入（需要登录）</p>
<p>​	   直接从文档中的插件时长导入到<code>HBuilder X</code> 中，选择项目，组件就会安装到<code>uni_modules</code>下，<strong>无需注册引入</strong>，直接使用</p>
<h2 id="各个端的兼容问题"><a href="#各个端的兼容问题" class="headerlink" title="各个端的兼容问题"></a>各个端的兼容问题</h2><p>1、隐藏滚动条问题</p>
<blockquote>
<p>  <strong>scroll-view</strong> 的 <strong>:show-scrollbar&#x3D;”false”</strong> 隐藏滚动条 h5 端不生效，需要找到对应元素将 ::–webkit-scrollar{display:none}</p>
</blockquote>
<p>2、微信小程序本地背景图片</p>
<blockquote>
<p>  要么使用<strong>服务器上的图片</strong>，要么使用<strong>base64</strong>当做背景图片，uni中小于40kb运行到小程序会自动转base64, 如果用太大的本地图片单做背景，小程序端将无法显示</p>
</blockquote>
<h2 id="资源"><a href="#资源" class="headerlink" title="资源"></a>资源</h2><p><a target="_blank" rel="noopener" href="https://juejin.cn/post/7132272611366535182#heading-8">掘金1</a></p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://example.com">lzoxun</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2023/07/22/web/web-app-uniapp-2023/">http://example.com/2023/07/22/web/web-app-uniapp-2023/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">学习笔记</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/07/22/web/web-app-uniapp-mumu/" title="mumu 手机模拟器】"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">mumu 手机模拟器】</div></div></a></div><div class="next-post pull-right"><a href="/2023/07/22/web/web-app-uniapp/" title="uni-app"><div class="cover" style="background: var(--default-bg-color)"></div><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">uni-app</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="https://i.loli.net/2021/02/24/5O1day2nriDzjSu.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">lzoxun</div><div class="author-info__description"></div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">108</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/liaozhongxun"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/liaozhongxun" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:869664233@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">这是我的文档</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%80%E5%90%AFuniapp"><span class="toc-number">1.</span> <span class="toc-text">开启uniapp</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Hbuilder-X"><span class="toc-number">1.1.</span> <span class="toc-text">Hbuilder X</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84"><span class="toc-number">2.</span> <span class="toc-text">目录结构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#pages-json"><span class="toc-number">2.1.</span> <span class="toc-text">pages.json</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#App-vue"><span class="toc-number">2.2.</span> <span class="toc-text">App.vue</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#pages"><span class="toc-number">2.3.</span> <span class="toc-text">pages</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E8%B7%AF%E7%94%B1%E8%B7%B3%E8%BD%AC"><span class="toc-number">2.3.1.</span> <span class="toc-text">路由跳转</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#main-js"><span class="toc-number">2.4.</span> <span class="toc-text">main.js</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#manifest-json"><span class="toc-number">2.5.</span> <span class="toc-text">manifest.json</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#uni-scss"><span class="toc-number">2.6.</span> <span class="toc-text">uni.scss</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#unpackage"><span class="toc-number">2.7.</span> <span class="toc-text">unpackage</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%86%E5%8C%85"><span class="toc-number">2.8.</span> <span class="toc-text">分包</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#UNI-push"><span class="toc-number">3.</span> <span class="toc-text">UNI push</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#UI%E5%BA%93"><span class="toc-number">4.</span> <span class="toc-text">UI库</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#uni-ui"><span class="toc-number">4.0.1.</span> <span class="toc-text">uni-ui</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%90%84%E4%B8%AA%E7%AB%AF%E7%9A%84%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98"><span class="toc-number">5.</span> <span class="toc-text">各个端的兼容问题</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%B5%84%E6%BA%90"><span class="toc-number">6.</span> <span class="toc-text">资源</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-11/" title="win 11 set">win 11 set</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-gitbash/" title="git bash">git bash</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-wsl/" title="wsl">wsl</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/window/win-main/" title="window">window</a><time datetime="2023-07-22T07:14:09.700Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/2023/07/22/web/%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98/" title="兼容问题">兼容问题</a><time datetime="2023-07-22T07:14:09.699Z" title="发表于 2023-07-22 15:14:09">2023-07-22</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By lzoxun</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><div class="js-pjax"></div><script id="canvas_nest" defer="defer" color="0,0,255" opacity="0.7" zIndex="-1" count="99" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-nest.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div class="no-result" id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/haruto.model.json"},"display":{"position":"right","width":100,"height":200,"right":300},"mobile":{"show":true}});</script></body></html>